﻿using Common.Library.Db;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common.Library.Logs
{
    public class SqlServerLog : ILog
    {

        public void WriteLog(SystemType systemType, ErrorType errorType, string MethodName, string param, string message)
        {
            string sql = $@"INSERT INTO [dbo].[Com_LoggerMessage]
           ([KeyId]
           ,[SystemType]
           ,[ErrorType]
           ,[MethodName]
           ,[Param]
           ,[Message]
           ,[CreateTime])
     VALUES
           ('{ Guid.NewGuid().ToString() }'
           ,'{ systemType.ToString() }'
           ,'{ errorType.ToString() }'
           ,'{ MethodName }'
           ,'{ param }'
           ,'{ message }'
           ,'{ DateTime.Now } ')";
            AppDBContextFactory.GetAppDBContext().ExecuteCommand(sql);
        }

    }
}
